var express = require('express');
var router = express.Router();
                                                                          // typesService
const {getAll2,deletOne2,addOne2,getOne2,updateOne2} = require('../service/typesService');
/* GET users listing. */
router.get('/getAll', async (req, res) => {
    res.send(await getAll2());
});

router.post('/del',async (req, res) =>{
    const typesId = req.body;
    const data = await deletOne2(typesId);
    res.send(data);
 })

 router.post('/add',async (req,res)=>{
    const types = req.body;
    const data = await addOne2(types);
    res.send(data);
  })
  //修改  1.获取
router.get('/getOne',async (req,res)=>{
    const _Id = req.query;
    res.send(await getOne2(_Id));
  })
  //修改 2.确认修改
  router.post('/updateOne',async (req,res)=>{
    const update = req.body;
    res.send(await updateOne2(update));
  })
module.exports = router;